package com.electronsys.emp.action;

import java.util.Date;

import com.electronsys.emp.service.EmpDaoService;
import com.electronsys.pojo.Employee;
import com.electronsys.pojo.Log;
import com.electronsys.pojo.Module;
import com.electronsys.pojo.ModuleContent;
import com.opensymphony.xwork2.ActionSupport;

public class UpdateEmpAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9153701495788755001L;
	public EmpDaoService empDaoService;
	private Employee emp;
	public Log log;
	
	public String execute(){
		
		empDaoService.updateEmp(emp);
		Module module  = new Module(3003);
		ModuleContent moduleContent =new ModuleContent(5005);
		Employee employee = new Employee(1001);
        log = new Log();
		log.setLogDate(new Date());
		log.setModule(module);
		log.setModuleContent(moduleContent);
		log.setEmployee(employee);
		
		empDaoService.logEmp(log);
		
		
		return "success";
	}

	public Employee getEmp() {
		return emp;
	}

	public void setEmp(Employee emp) {
		this.emp = emp;
	}

	public void setEmpDaoService(EmpDaoService empDaoService) {
		this.empDaoService = empDaoService;
	}
}
